package com.api.wall.geteventsbyid;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IWallApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.CollectionResultApi;
import com.zyncro.api.model.EventApi;

@ContextConfiguration(locations = "classpath:/wall/wall-static.xml")
public class GetEventsById extends AbstractApiTest {

	@Value("#{group_toGetComments[participant].appId}")
	private String userUrn;

	@Value("#{group_toGetComments[participant].password}")
	private String userPassword;

	@Value("#{group_toGetComments.eventUrn}")
	private String eventUrn;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test
	public void testGetEventsForList() throws ZyncroApiException {

		boolean includeHtml = false;
		boolean includeProperties = false;

		List<String> eventsList = new ArrayList<String>();
		eventsList.add(eventUrn);

		CollectionResultApi<EventApi> result = getApi().getService(IWallApiService.class).getEventsById(eventsList, includeHtml,
				includeProperties);

		Assert.assertEquals(result.getElements().size(), 1);
	}
}
